var http = require('http');
var fs = require('fs');
var url = require('url');

var hostname = '127.0.0.1';
var port = '3000';

var server = http.createServer(function (req,res){
    if(req.url == 'favicon.ico'){return};

    // 得到用户的路径
    console.log(pathname);

    // 读取访问文件
    fs.readFile('./static/'+pathname,function(err,data){
        if (err){
            console.log(err);
            res.end('404 文件不存在');
        }
        res.end(data);
    });
});

server.listen(port,hostname);
